Get premium membership and access questions with answers, video lessons as well as revision papers.

Given the following program, convert all appropriate references to class members to explicit this pointer references. #include using namespace std; class myclass { int a, b; public: myclass(int n, int...

      

Given the following program, convert all appropriate references to class members to explicit this pointer references.
#include
using namespace std;
class myclass {
int a, b;
public:
myclass(int n, int m,) {a=n; b=m;}
int add() {return a+b; }
void show();
};
void myclass::show()
{
t = add(); //call member function
cout <}
int main()
{
myclass ob(10, 14);
ob.show();
return 0;
}

  

Answers


Davis
// Use this pointer
#include
using namespace std;
class myclass {
int a, b;
public:
myclass() {this->a=n; this->b=m;}
int add() {return this->a + this->b; }
void show
};
void myclass:: show()
{
int t;
t = this->add(); // call member function
cout <}
int main()
{
myclass ob(10, 14);
ob.show();
return 0;
}
Githiari answered the question on May 31, 2018 at 17:18


Next: Describe the benefits of workforce planning
Previous: Explain the advantages of internal (organic) growth.

View More Computer Studies Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions